package lms.dwr.demo.service;

import java.util.List;
import java.util.Map;

import lms.dwr.demo.common.ServiceException;
import lms.dwr.demo.model.ModelSystemOption;
import lms.dwr.demo.web.component.pagination.PaginationSupport;

/**
 * The system option service
 * 
 * @author Jeccy.Zhao
 *
 */
public interface ServiceSystemOption 
extends ServiceBase
{
	
	/**
	 * Obtains list of system option entities
	 * with the specified entity
	 * 
	 * @param entity
	 *                the system option entity
	 * @param order
	 *                the ordered field name
	 * @param isDesc
	 *                the ordered direction
	 * @return list of system option entities
	 * @throws ServiceException
	 */
	List<ModelSystemOption> getModelSystemOptionListByEntity(ModelSystemOption entity, 
			String order, Boolean isDesc) throws ServiceException;
	
	/**
	 * Obtains list of system option entities
	 * with the specified slug name. 
	 * 
	 * @param optionSlugName
	 *         the system option slug name
	 * @return list of system option entities
	 * @throws ServiceException
	 */
	List<ModelSystemOption> getModelSystemOptionListBySlug(String optionSlugName)
			throws ServiceException;
	
	/**
	 * Obtains list of system option entities
	 * with the specified slug name and option name
	 * 
	 * @param optionSlugName
	 *           the system option slug name
	 * @param optionName
	 *           the system option name
	 * @return list of system option entities
	 * @throws ServiceException
	 */
	List<ModelSystemOption> getModelSystemOptionListBySlugAndName(String optionSlugName,
			String optionName) throws ServiceException;
	
	/**
	 * Obtains list of system option entities
	 * with the specified slug name and option value
	 * 
	 * @param optionSlugName
	 *           the system option slug name
	 * @param optionValue
	 *           the system option value
	 * @return list of system option entities
	 * @throws ServiceException
	 */
	List<ModelSystemOption> getModelSystemOptionListBySlugAndValue(String optionSlugName,
			String optionValue) throws ServiceException;
	
	/**
	 * Obtains the system option entities with pagination
	 * by the specified system option slug name
	 * 
	 * @param optionSlugName
	 *           the system option slug name
	 * @param pageSize
	 *           the page size
	 * @param startIndex
	 *           the start index
	 * @param order
	 *           the ordered field name
	 * @param isDesc
	 *           the flag on DESC
	 * @return system option entities with pagination
	 * @throws ServiceException
	 */
	PaginationSupport<ModelSystemOption> getModelSystemOptionPageBySlug(String optionSlugName, 
			int pageSize, int startIndex, String order, Boolean isDesc) throws ServiceException;
	
	/**
	 * Obtains the system option entities with pagination
	 * by the specified system option slug name and option name
	 * 
	 * @param optionSlugName
	 *           the system option slug name
	 * @param optionName
	 *           the system option name
	 * @param pageSize
	 *           the page size
	 * @param startIndex
	 *           the start index
	 * @param order
	 *           the ordered field name
	 * @param isDesc
	 *           the flag on DESC
	 * @return system option entities with pagination
	 * @throws ServiceException
	 */
	PaginationSupport<ModelSystemOption> getModelSystemOptionPageBySlugAndName(String optionSlugName, 
			String optionName, int pageSize, int startIndex, String order, Boolean isDesc) throws ServiceException;
	
	/**
	 * Obtains map of system option entities 
	 * with the specified option slug name
	 * 
	 * @param optionSlugName
	 *           the system option slug name
	 * @return map of system option entities
	 * @throws ServiceException
	 */
	Map<String, ModelSystemOption> getModelSystemOptionMapBySlug(String optionSlugName)
			throws ServiceException;
	
	/**
	 * 
	 * Obtains map of system option entities 
	 * with the specified option slug name
	 * 
	 * @param optionSlugName
	 *           the system option slug name
	 * @param optionName
	 *           the system option name
	 * @return map of system option entities
	 * @throws ServiceException
	 */
	Map<String, ModelSystemOption> getModelSystemOptionMapBySlugAndName(String optionSlugName, 
			String optionName) throws ServiceException;
	
	/**
	 * Obtains the system option entity by id
	 * 
	 * @param id
	 *         the system option entity id
	 * @return system option entity model
	 * @throws ServiceException
	 */
	ModelSystemOption getModelSystemOptionById(String id)
			throws ServiceException;
	
	/**
	 * Removes the system option entity by id
	 * 
	 * @param id
	 *         the system option entity id
	 * @return true if removes succeed; false otherwise
	 * @throws ServiceException
	 */
	boolean removeModelSystemOption(String id)
			throws ServiceException;
	
	/**
	 * Removes the system option entity by model
	 * 
	 * @param modelSystemOption
	 *           the system option entity model
	 * @return true if removes succeed; false otherwise
	 * @throws ServiceException
	 */
	boolean removeModelSystemOption(ModelSystemOption modelSystemOption)
			throws ServiceException;
	
	/**
	 * Saves the specified system option entity 
	 * and returns the entity id after saves succeed.
	 * 
	 * @param modelSystemOption
	 *           the system option entity model
	 * @return the system option entity id after saves
	 * @throws ServiceException
	 */
	String saveModelSystemOption(ModelSystemOption modelSystemOption)
			throws ServiceException;
	
}
